package com.forekonw.demo5;

/**
 * 方法与构造器重载
 */
public class OverloadDemo {
    private  int age;
    private String name;

    public OverloadDemo(int age,String name){
        this.age = age;
        this.name = name;
    }
    public  OverloadDemo(){

    }

    public int add (int a ,int b ){
        return  a+b;
    }
    public int add (int a ,int b ,int c){
        return  a+b+c;
    }

    public static void main(String[] args) {
        OverloadDemo over = new OverloadDemo();
        int a = over.add(1,2,3);
        System.out.println(a);

        int b = over.add(1,2);
        System.out.println(b);
    }
}
